package cn.javabb.admin.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * 
 * @author QINB
 * @CreateDate 2018年9月24日 下午6:34:34
 * @since V1.0
 */
@Controller
@RequestMapping("/home")
public class HomeController {

    /**
     * 控制台
     */
    @RequestMapping("/console")
    public String console() {
        return "admin/home/console";
    }
    @GetMapping("/welcome")
    public String welcome(){
        return "admin/home/welcome";
    }
    /**
     * 消息弹窗
     */
    @RequestMapping("/message")
    public String message() {
        return "admin/home/message";
    }

    /**
     * 修改密码弹窗
     */
    @RequestMapping("/password")
    public String password() {
        return "admin/home/password";
    }
    /**
     * 便签管理
     */
    @RequestMapping("/note")
    public String note() {
        return "admin/home/note";
    }
    /**
     * 主题设置弹窗
     */
    @RequestMapping("/theme")
    public String theme() {
        return "admin/home/theme";
    }

    /**
     * 设置主题
     */
    @RequestMapping("/setTheme")
    public String setTheme(String themeName, HttpServletRequest request) {
        if (null == themeName) {
            request.getSession().removeAttribute("theme");
        } else {
            request.getSession().setAttribute("theme", themeName);
        }
        return "redirect:/admin";
    }
}
